#coding=utf-8

import logging
import UserManager
import Game
from pycommon import Pack as packet
from pycommon import Const
from pycommon import RemoteManager
import HallManager

from mj import mjTable,mjConst, mjParse, mjUser, mjConfig


class GameMj(Game.GameBase):
    
    def __init__(self):
        Game.GameBase.__init__(self)
    
    def start(self):
        RemoteManager.instance.addConfigCallback(mjConfig.instance)

    def stop(self):
        pass    
    
    def getName(self):
        return mjConst.NAME_GAME
    
    def createUser(self,uid):
        return mjUser.MjUser(uid)
    
    def createTable(self, tid, hc, tabletype):
        return mjTable.MjTable(tid, hc)
    
    def parsePacket(self, client, cmd, pkt):
        return mjParse.parse(client, cmd, pkt)
    
    def onCheckUserSuc(self,uid):
        pass
        
    def onUserGameInfo(self, uid):
        pass
    
    def onLoginGameResult(self,uid,code):
        UserManager.instance.onUserLoginResult(uid,code)
        pass


    def onUserEnterHall(self, uid, hallId):
        pass
       
    def onUserLeaveHall(self, uid, hallId, reason):
        pass
    
    def onUserLeave(self, uid):
        pass    
            
instance = GameMj()

def createGame():
    return instance

if __name__ == '__main__':
    pass
